//
//  LiveCollectionViewCell.m
//  LOL视频播放
//
//  Created by 花花蔡 on 2016/12/14.
//  Copyright © 2016年 com.HuaHuaCai. All rights reserved.
//

#import "LiveCollectionViewCell.h"
#import "Public.h"
#import "UIImageView+WebCache.h"
@interface LiveCollectionViewCell ()

@property(nonatomic,strong) UIImageView *imageView;
@property(nonatomic,strong) UILabel *nameLabel;
@property(nonatomic,strong) UIView *nameView;
@property(nonatomic,strong) UILabel *titleLabel;


@end

@implementation LiveCollectionViewCell

- (void)setModel:(LiveModel *)model {
    [_imageView sd_setImageWithURL:[NSURL URLWithString:model.pic] placeholderImage:[UIImage imageNamed:@"占位图"]];
    _nameLabel.text = model.title;
    _titleLabel.text = model.subtitle;
}


- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self createCell];
    }
    return self;
}

- (void)createCell {
    _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height - 80 * KWidth_ScaleW)];
    _imageView.layer.cornerRadius = 7;
    _imageView.layer.masksToBounds = YES;
    _nameView = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_imageView.frame) - 15 * KWidth_ScaleW, self.frame.size.width, 15 * KWidth_ScaleW)];
    _nameView.backgroundColor = [UIColor blackColor];
    _nameView.alpha = 0.4;
    [_imageView addSubview:_nameView];
    [self.contentView addSubview:_imageView];
    
    _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMinY(self.nameView.frame), 180 * KWidth_ScaleW, 15 * KWidth_ScaleW)];
    _nameLabel.font = [UIFont systemFontOfSize:14 * KWidth_ScaleW];
    //_nameLabel.alpha = 0.9;
    _nameLabel.textColor = [UIColor whiteColor];
    [self.contentView addSubview:_nameLabel];
    
    _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_imageView.frame) + 7 * KWidth_ScaleW, CGRectGetWidth(self.frame), 40* KWidth_ScaleW)];
    _titleLabel.font = [UIFont systemFontOfSize:16 * KWidth_ScaleW];
    _titleLabel.numberOfLines = 0;
    [self.contentView addSubview:_titleLabel];
    
//    _imageView.backgroundColor = [UIColor lightGrayColor];
//    _titleLabel.text = @"test-----teat";
}


@end
